﻿Imports System
Imports System.Collections.Generic

Namespace System.Workflow.Activities
    <Serializable> _
    Public Class MessageEventSubscription
        ' Methods
        Protected Sub New()
        End Sub

        Public Sub New(ByVal queueName As IComparable, ByVal instanceId As Guid)
            Me.New(queueName, instanceId, Guid.NewGuid)
        End Sub

        Public Sub New(ByVal queueName As IComparable, ByVal instanceId As Guid, ByVal subscriptionId As Guid)
            Me.New(queueName, instanceId, Nothing, Nothing, subscriptionId)
        End Sub

        Public Sub New(ByVal queueName As IComparable, ByVal subscriptionId As Guid, ByVal interfaceType As Type, ByVal operation As String)
            Me.New(queueName, Guid.Empty, interfaceType, operation, subscriptionId)
        End Sub

        Public Sub New(ByVal queueName As IComparable, ByVal instanceId As Guid, ByVal interfaceType As Type, ByVal operation As String, ByVal subscriptionId As Guid)
            Me.queueName = queueName
            Me.workflowInstanceId = instanceId
            Me.subscriptionId = subscriptionId
            Me.interfaceType = interfaceType
            Me.operation = operation
            Me.predicates = New List([Of] CorrelationProperty)
        End Sub


        ' Properties
        Public Overridable ReadOnly Property CorrelationProperties As ICollection([Of] CorrelationProperty)
            Get
                Return Me.predicates
            End Get
        End Property

        Public Overridable Property InterfaceType As Type
            Get
                Return Me.interfaceType
            End Get
            Set(ByVal value As Type)
                Me.interfaceType = value
            End Set
        End Property

        Public Overridable Property MethodName As String
            Get
                Return Me.operation
            End Get
            Set(ByVal value As String)
                Me.operation = value
            End Set
        End Property

        Property QueueName As IComparable
            Public Overridable Get
                Return Me.queueName
            End Get
            Protected Overridable Set(ByVal value As IComparable)
                Me.queueName = value
            End Set
        End Property

        Public Overridable ReadOnly Property SubscriptionId As Guid
            Get
                Return Me.subscriptionId
            End Get
        End Property

        Public Overridable ReadOnly Property WorkflowInstanceId As Guid
            Get
                Return Me.workflowInstanceId
            End Get
        End Property


        ' Fields
        Private interfaceType As Type
        Private operation As String
        Private predicates As List([Of] CorrelationProperty)
        Private queueName As IComparable
        Private subscriptionId As Guid
        Private workflowInstanceId As Guid
    End Class
End Namespace

